package cn.gjculture.shopping.api.scheduler;

import org.quartz.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class QuartzConfig {

    @Bean
    public JobDetail supplierTransferDetail(){
        return JobBuilder.newJob(SupplierTransferTask.class).withIdentity("supplierTransfer")
                .storeDurably().build();
    }

    @Bean
    public Trigger testQuartzTrigger(){
        //0 0 15 * * ?
        CronScheduleBuilder cronScheduleBuilder=CronScheduleBuilder.cronSchedule("0 0 0/2 * * ?");
        return TriggerBuilder.newTrigger().forJob(supplierTransferDetail())
                .withIdentity("supplierTransfer").withSchedule(cronScheduleBuilder).build();
    }


}
